Skip to content

Check for the new direct invocation trace format and use that - #194

Merged
agocs merged 5 commits into
mainfrom
chris.agocs/new_direct_invocation_trace_propogation_format
Jun 21, 2021
Merged

agocs merged 5 commits into
mainfrom
chris.agocs/new_direct_invocation_trace_propogation_format

Conversation

@agocs

@agocs agocs commented Jun 21, 2021

Copy link
Copy Markdown
Contributor

What does this PR do?

Updates datadog-lambda-python so it can extract trace contexts stored in context.client_context.custom using the new propagation format, described in this doc: https://docs.google.com/document/d/1pruSeesAr2bAVMtz_rUlsiBZKFoFWdB4nSq5Vuym2l8/edit#heading=h.ptr8uhqw5ht

Motivation

Storing a map containing trace context in context.client_context.custom._datadog causes compatibility issues with Go and Java lambda functions. C.f. aws/aws-lambda-java-libs#212. We're updating the trace propagation format to fix this issue.

Testing Guidelines

Additional Notes

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

@agocs
agocs requested a review from a team as a code owner June 21, 2021 16:00
@agocs agocs added the WIP label Jun 21, 2021
@agocs agocs removed the WIP label Jun 21, 2021
Comment thread src/trace/context.ts Outdated
let traceData = null;

if (
custom._datadog &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you could use .hasOwnProperty as well for _datadog ?

Comment thread src/trace/context.ts
const custom = context.clientContext?.custom;

if (!traceData || typeof traceData !== "object") {
if (!custom || typeof custom !== "object") {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a test to validate this condition could be useful ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@maxday

maxday commented Jun 21, 2021

Copy link
Copy Markdown
Contributor

LGTM ! I left minor comments

@maxday
maxday self-requested a review June 21, 2021 19:59
@agocs
agocs merged commit b53b8c6 into main Jun 21, 2021
@agocs
agocs deleted the chris.agocs/new_direct_invocation_trace_propogation_format branch June 21, 2021 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants